﻿using System;
using System.Linq;
using Stamp_For_Africa_Version_2.Models;

namespace Stamp_For_Africa_Version_2.Repositories
{
  public class SeriesRepository
  {
    private StampsDataContext db = new StampsDataContext();
    //
    // Query Methods

    public IQueryable<Series> FindAllSeries()
    {
      return db.Series;
    }


    public Series GetSeries(Guid id)
    {
      return db.Series.SingleOrDefault(d => d.Id == id);
    }

    //
    // Insert/Delete Methods

    public void Add(Series series)
    {
      db.Series.InsertOnSubmit(series);
    }

    public void Delete(Series series)
    {
      db.Series.DeleteOnSubmit(series);
    }

    //
    // Persistence

    public void Save()
    {
      db.SubmitChanges();
    }


  }
}